<template>
  <view :class="$style.header">
    <image src="http://192.168.3.210:8380/file-service/file/view//miniprogram/profileheader1534359992302305280.png"
      mode="widthFix" style="width: 100vw; z-index: -1;"> </image>

    <!-- 已登录 -->
    <view v-if="auth.isLogin">
      <view class="absolute" :class="$style.info">
        <view class="company">港华燃气</view>
        <view class="flex" style="margin-top: 10rpx">
          <view class="name">{{ auth.userInfo.nickName }}</view>
          <view :class="$style.state">在岗</view>
        </view>
      </view>
      <view class="absolute" :class="$style.photo">
        <image class="" :src="personImg" mode="widthFix" style="width: 100%;">
        </image>
      </view>
    </view>
    <!-- 未登录 -->
    <!-- <block v-else>
      <view class="absolute" :class="$style.info">
        <view class="company underline" @tap="onLogin">请登录</view>
        <view class="flex" style="margin-top: 10rpx">
          <view class="name">--</view>
          <view :class="$style.state">--</view>
        </view>
      </view>
      <view class="absolute" :class="$style.photo">
        <image class="" :src="personImg" mode="widthFix" style="width: 100%;">
        </image>
      </view>
    </block> -->
  </view>

</template>

<script setup lang='ts'>

import { useAuthStore } from "@/store";
import { ref } from "vue";

// import { testGet } from "@/api";
// testGet().then((res:any)=>{
//   console.log(res)
// }).catch((e:any)=>{
//   console.log(e)
// })

const personImg = ref<string>(
  "https://tse1-mm.cn.bing.net/th/id/R-C.232904c2ee9450d3afabd2c553477793?rik=Wrs6xV46pcnU%2fg&riu=http%3a%2f%2fwww.sucaijishi.com%2fuploadfile%2f2016%2f0203%2f20160203022635285.png&ehk=qK8HIsKsLMdhbBUdvvlQJnmEw7K%2fpbcfFp5ZrHO2F9w%3d&risl=&pid=ImgRaw&r=0"
);

const auth = useAuthStore();
// const { setAuthStore, resetAuthStore } = useAuthStore();

// const onLogin = () => {
//   wx.getUserProfile({
//     desc: "用于完善会员资料", // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
//     success: (res) => {
//       setAuthStore({
//         userId: "1",
//         avatarUrl: res.userInfo.avatarUrl,
//         nickName: res.userInfo.nickName,
//         status: "Lv1",
//         userMobile: "1382550699x",
//       });
//     },
//   });
// };
</script>

<style lang='less' module>
.header {
  width: 100vw;
  position: relative;

  .info {
    bottom: 80rpx;
    left: 80rpx;
    font-size: 48rpx;
    font-family: Microsoft YaHei;
    color: #fdfbfb;
  }

  .state {
    width: 79rpx;
    text-align: center;
    font-size: 28rpx;
    color: #fdfbfb;
    font-weight: normal;
    margin-left: 20rpx;
    line-height: 60rpx;
    border-bottom: 1px solid #ffffff;
  }

  .photo {
    bottom: 40rpx;
    right: 80rpx;
    width: 130rpx;
    height: 130rpx;
  }
}
</style>
